﻿using System.Collections.Generic;
using Core.Process;
using Core.ProcessManager.Process;
using Core.ProcessManager.ProcessLoader;

namespace Core.ProcessLoaderFiction
{
    public class ProcessLoader : IProcessLoader
    {
        public List<IProcess> LoadAll()
        {
            var processes = new List<IProcess>();

            var standartProcess = InitializeActions();
            standartProcess.Name = "Изготовление компонентов";

            processes.Add(standartProcess);

            return processes;
        }

        private static IProcess InitializeActions()
        {
            var startAction = new StandartAction
            {
                ExecutionTime = 0,
                FinalMessage = "Start",
                Name = "Start",
                Level = 0
            };

            var finalAction = new StandartAction
            {
                ExecutionTime = 0,
                FinalMessage = "End",
                Name = "End",
                Level = 3
            };

            var nbk = new StandartAction
            {
                ExecutionTime = 5000,
                InitialMessage = "Нарезка бортовых колец",
                FinalMessage = "Нарезка бортовых колец",
                Name = "Нарезка бортовых колец",
                Level = 1
            };

            var vtk = new StandartAction
            {
                ExecutionTime = 8000,
                InitialMessage = "Вязка текстильного корда",
                FinalMessage = "Вязка текстильного корда",
                Name = "Вязка текстильного корда",
                Level = 1
            };

            var vsb = new StandartAction
            {
                ExecutionTime = 3000,
                InitialMessage = "Выплавка стальных брекетов",
                FinalMessage = "Выплавка стальных брекетов",
                Name = "Выплавка стальных брекетов",
                Level = 1
            };

            var sbp = new StandartAction
            {
                ExecutionTime = 2000,
                InitialMessage = "Сборка брекерного пакета",
                FinalMessage = "Сборка брекерного пакета",
                Name = "Сборка брекерного пакета",
                Level = 2
            };

            var sk = new StandartAction
            {
                ExecutionTime = 4000,
                InitialMessage = "Сборка каркаса",
                FinalMessage = "Сборка каркаса",
                Name = "Сборка каркаса",
                Level = 2
            };        

            var standartProcess = new StandartProcess();

            standartProcess.Actions.Add(startAction);
            standartProcess.Actions.Add(nbk);
            standartProcess.Actions.Add(vtk);
            standartProcess.Actions.Add(vsb);
            standartProcess.Actions.Add(sk);
            standartProcess.Actions.Add(sbp);
            standartProcess.Actions.Add(finalAction);

            return standartProcess;
        }
    }
}